package com.fortune.service.impl;

import com.fortune.dao.ReturnDepositDao;
import com.fortune.dto.in.returnDeposit.AddDto;
import com.fortune.dto.in.returnDeposit.EditDto;
import com.fortune.service.ReturnDepositService;
import com.fortune.vo.returnDeposit.ReturnDepositInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReturnDepositServiceImpl implements ReturnDepositService {
    @Autowired
    private ReturnDepositDao returnDepositDao;

    /**
     * 新增工单
     * @param addDto
     * @param mid
     * @param did
     * @param crdid
     * @return
     */
    @Override
    public int addReturnDeposit(AddDto addDto, String mid, String did, String crdid) {
        int addReturnDeposit = returnDepositDao.addReturnDeposit(addDto, mid, did, crdid);
        return addReturnDeposit;
    }

    /**
     * 编辑工单
     * @param editDto
     * @param mid
     * @param did
     * @return
     */
    @Override
    public int editReturnDeposit(EditDto editDto, String mid, String did) {
        int editReturnDeposit = returnDepositDao.editReturnDeposit(editDto, mid, did);
        return editReturnDeposit;
    }

    /**
     * 删除工单
     * @param id
     * @return
     */
    @Override
    public int deleteReturnDeposit(String id) {
        int deleteReturnDeposit = returnDepositDao.deleteReturnDeposit(id);
        return deleteReturnDeposit;
    }

    /**
     * 未处理工单
     * @param mid
     * @param did
     * @param userId
     * @return
     */
    @Override
    public List<ReturnDepositInfo> findReturnDepositInfoByUn(String mid, String did, String userId) {
        List<ReturnDepositInfo> findReturnDepositInfoByUn = returnDepositDao.findReturnDepositInfoByUn(mid, did, userId);
        return findReturnDepositInfoByUn;
    }

    /**
     * 已批准工单
     * @param mid
     * @param did
     * @param userId
     * @return
     */
    @Override
    public List<ReturnDepositInfo> findReturnDepositInfoByApproved(String mid, String did, String userId) {
        List<ReturnDepositInfo> findReturnDepositInfoByApproved = returnDepositDao.findReturnDepositInfoByApproved(mid, did, userId);
        return findReturnDepositInfoByApproved;
    }

    /**
     * 已接货工单
     * @param mid
     * @param did
     * @param userId
     * @return
     */
    @Override
    public List<ReturnDepositInfo> findReturnDepositInfoByReceived(String mid, String did, String userId) {
        List<ReturnDepositInfo> findReturnDepositInfoByReceived = returnDepositDao.findReturnDepositInfoByReceived(mid, did, userId);
        return findReturnDepositInfoByReceived;
    }

    /**
     * 已完成工单
     * @param mid
     * @param did
     * @param userId
     * @return
     */
    @Override
    public List<ReturnDepositInfo> findReturnDepositInfoByCompleted(String mid, String did, String userId) {
        List<ReturnDepositInfo> findReturnDepositInfoByCompleted = returnDepositDao.findReturnDepositInfoByCompleted(mid, did, userId);
        return findReturnDepositInfoByCompleted;
    }
}
